{% extends "base.html" %}
{% load i18n %}
{% load display_tags %}
{% load static %}

{% block content %}
    {{ block.super }}
    <h3> {{ name }} {% if to_edit %}- {{ to_edit.username }}{% endif %}</h3>
    <form class="form-horizontal" method="post">{% csrf_token %}
        <fieldset>
            <legend>{% trans "Default Information" %}</legend>
            {% include "dojo/form_fields.html" with form=form %}
        </fieldset>
        <fieldset>
            <legend>{% trans "Additional Contact Information" %}</legend>
            {% include "dojo/form_fields.html" with form=contact_form %}
        </fieldset>
        <fieldset>
            <legend>{% trans "Global Role" %}</legend>
            {% include "dojo/form_fields.html" with form=global_role_form %}
        </fieldset>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <input class="btn btn-primary" type="submit" name="add_user" value="{% trans "Submit" %}"/>
            </div>
        </div>
    </form>
{% endblock %}
{% block postscript %}
    {{ block.super }}
    <!-- TODO: user is not defined and not secure -->
    {% if not user.is_superuser %}
        <script type="application/javascript">
            $(function () {
                $('#id_is_superuser').parents(".form-group").remove();
            });
        </script>
    {% endif %}
{% endblock %}
